/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.baatar.opt.genetic;

import java.io.Serializable;
import org.baatar.opt.genetic.chromosome.IChromosomeFactory;
import org.baatar.opt.genetic.crossover.ICrossoverOperator;
import org.baatar.opt.genetic.improve.IImprover;
import org.baatar.opt.genetic.mutation.IMutator;
import org.baatar.opt.genetic.selection.ISelection;

/**
 *
 * @author Ba
 */
public class AlgorithmParameters<T, M> implements Serializable {

    private int maxNumOfIterations = 1000;
    private int maxNumOfIterationsWOProgress = 200;
    private int populationSize = 100;
    private int minNumOfChildren = 20;
    private int numOfEliteChromosomes = 4;
    private float mutationRate = 0.02f;
    private float greedRate = 0.0f;
    private boolean allowDublicateChromosomes = false;
    private int migrationRate = 0;
    private int migrationFreq = 0;

    private IChromosomeFactory<T, M> chromosomeFactory = null;
    private ISelection<T, M> selector = null;
    private ICrossoverOperator<T, M> crossoverOperator = null;
    private IMutator<T, M> mutator = null;
    private IImprover<T, M> improver = null;

    /**
     * @return the maxNumOfIterations
     */
    public int getMaxNumOfIterations() {
        return maxNumOfIterations;
    }

    /**
     * @param maxNumOfIterations the maxNumOfIterations to set
     */
    public void setMaxNumOfIterations(int maxNumOfIterations) {
        this.maxNumOfIterations = maxNumOfIterations;
    }

    /**
     * @return the maxNumOfIterationsWOProgress
     */
    public int getMaxNumOfIterationsWOProgress() {
        return maxNumOfIterationsWOProgress;
    }

    /**
     * @param maxNumOfIterationsWOProgress the maxNumOfIterationsWOProgress to set
     */
    public void setMaxNumOfIterationsWOProgress(int maxNumOfIterationsWOProgress) {
        this.maxNumOfIterationsWOProgress = maxNumOfIterationsWOProgress;
    }

    /**
     * @return the populationSize
     */
    public int getPopulationSize() {
        return populationSize;
    }

    /**
     * @param populationSize the populationSize to set
     */
    public void setPopulationSize(int populationSize) {
        this.populationSize = populationSize;
    }

    /**
     * @return the minNumOfChildren
     */
    public int getMinNumOfChildren() {
        return minNumOfChildren;
    }

    /**
     * @param minNumOfChildren the minNumOfChildren to set
     */
    public void setMinNumOfChildren(int minNumOfChildren) {
        this.minNumOfChildren = minNumOfChildren;
    }

    /**
     * @return the numOfEliteChromosomes
     */
    public int getNumOfEliteChromosomes() {
        return numOfEliteChromosomes;
    }

    /**
     * @param numOfEliteChromosomes the numOfEliteChromosomes to set
     */
    public void setNumOfEliteChromosomes(int numOfEliteChromosomes) {
        this.numOfEliteChromosomes = numOfEliteChromosomes;
    }

    /**
     * @return the mutationRate
     */
    public float getMutationRate() {
        return mutationRate;
    }

    /**
     * @param mutationRate the mutationRate to set
     */
    public void setMutationRate(float mutationRate) {
        this.mutationRate = mutationRate;
    }

    /**
     * @return the greedRate
     */
    public float getGreedRate() {
        return greedRate;
    }

    /**
     * @param greedRate the greedRate to set
     */
    public void setGreedRate(float greedRate) {
        this.greedRate = greedRate;
    }

    /**
     * @return the allowDublicateChromosomes
     */
    public boolean isAllowDublicateChromosomes() {
        return allowDublicateChromosomes;
    }

    /**
     * @param allowDublicateChromosomes the allowDublicateChromosomes to set
     */
    public void setAllowDublicateChromosomes(boolean allowDublicateChromosomes) {
        this.allowDublicateChromosomes = allowDublicateChromosomes;
    }

    /**
     * @return the selector
     */
    public ISelection<T, M> getSelector() {
        return selector;
    }

    /**
     * @param selector the selector to set
     */
    public void setSelector(ISelection<T, M> selector) {
        this.selector = selector;
    }

    /**
     * @return the crossoverOperator
     */
    public ICrossoverOperator<T, M> getCrossoverOperator() {
        return crossoverOperator;
    }

    /**
     * @param crossoverOperator the crossoverOperator to set
     */
    public void setCrossoverOperator(ICrossoverOperator<T, M> crossoverOperator) {
        this.crossoverOperator = crossoverOperator;
    }

    /**
     * @return the mutator
     */
    public IMutator<T, M> getMutator() {
        return mutator;
    }

    /**
     * @param mutator the mutator to set
     */
    public void setMutator(IMutator<T, M> mutator) {
        this.mutator = mutator;
    }

    /**
     * @return the chromosomeFactory
     */
    public IChromosomeFactory<T, M> getChromosomeFactory() {
        return chromosomeFactory;
    }

    /**
     * @param chromosomeFactory the chromosomeFactory to set
     */
    public void setChromosomeFactory(IChromosomeFactory<T, M> chromosomeFactory) {
        this.chromosomeFactory = chromosomeFactory;
    }

    /**
     * @return the improver
     */
    public IImprover<T, M> getImprover() {
        return improver;
    }

    /**
     * @param improver the improver to set
     */
    public void setImprover(IImprover<T, M> improver) {
        this.improver = improver;
    }

    /**
     * @return the migrationFrequency
     */
    public int getMigrationFreq() {
        return migrationFreq;
    }

    /**
     * @param migrationFrequency the migrationFrequency to set
     */
    public void setMigrationFreq(int migrationFreq) {
        this.migrationFreq = migrationFreq;
    }

    /**
     * @return the migrationRate
     */
    public int getMigrationRate() {
        return migrationRate;
    }

    /**
     * @param migrationRate the migrationRate to set
     */
    public void setMigrationRate(int migrationRate) {
        this.migrationRate = migrationRate;
    }
}
